<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>纯css点击切换方法一</title>
    <style>
        .box {
            width: 300px;
            height: 300px;
            border: 1px solid #000;
            text-align: center;
            margin: 0 auto;
            position: relative;
            top: 100px;
        }

        nav {
            width: 300px;
            height: 50px;
            border-bottom: 1px solid #000;
        }

        nav a {
            display: block;
            float: left;
            text-decoration: none;
            margin: 0 1px;
            width: 98px;
            height: 50px;
            background-color: aqua;
            line-height: 50px;
        }
        .content{
            width: 300px;
            height: 249px;
            overflow: hidden;  /* 隐藏超出部分 */
        }
        .cont{
            width: 300px;
            height: 249px;
            text-align: center;
            line-height: 249px;
            font-size: 30px;
        }
        #one{
            background-color: rgb(241, 213, 171);
        }
        #two{
            background-color: rgb(128, 186, 92);
        }
        #three{
            background-color: rgb(240, 16, 42);
        }
    </style>
</head>

<body>
    <div class="box">
        <nav>
            <!-- 通过点击不同的 a 标签，跳转到不同的 id 的标签元素中去，实现对不同元素的样式内容的改变。 -->
            <a href="#one">按钮1</a>
            <a href="#two">按钮2</a>
            <a href="#three">按钮3</a>
        </nav>
        <div class="content">
            <div id="one" class="cont">内容1</div>
            <div id="two" class="cont">内容2</div>
            <div id="three" class="cont">内容3</div>
        </div>
    </div>
</body>

</html>